package com.test.test

class MAIN {
    def  android2 = {
        compileSdkVersion 25
        buildToolsVersion "25.0.2"
        defaultConfig {
            minSdkVersion 15
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
        }
    }
    static void main(String[] args) {
        //闭包定义
        def android = {
            compileSdkVersion 25
            buildToolsVersion "25.0.2"
            defaultConfig {
                minSdkVersion 15
                targetSdkVersion 25
                versionCode 1
                versionName "1.0"
            }
        }

//调用
        com.test.test.Android bean = new com.test.test.Android()
        android.delegate = bean
        android.call()
        println bean.toString()
    }

//打印结果
//    Android{mCompileSdkVersion=25, mBuildToolsVersion='25.0.2', mProductFlavor=ProductFlavor{mVersionCode=1, mVersionName='1.0', mMinSdkVersion=15, mTargetSdkVersion=25}}
}
